Scroll to navigation

DIFF(1) User Commands DIFF(1)

NAME

diff - compare files line by line

SYNOPSIS

diff [OPTION]... FILES

DESCRIPTION

Compare files line by line.

Ignore case differences in file contents.
Ignore case when comparing file names.
Consider case when comparing file names.
-E --ignore-tab-expansion
Ignore changes due to tab expansion.
Ignore changes in the amount of white space.
Ignore all white space.
Ignore changes whose lines are all blank.
Ignore changes whose lines all match RE.
Strip trailing carriage return on input.
Treat all files as text.
Output NUM (default 3) lines of copied context.
Output NUM (default 3) lines of unified context.
Use LABEL instead of file name.
Show which C function each change is in.
-F RE --show-function-line=RE
Show the most recent line matching RE.
Output only whether files differ.
Output an ed script.
Output a normal diff.
Output an RCS format diff.
Output in two columns.
Output at most NUM (default 130) print columns.
Output only the left column of common lines.
Do not output common lines.
Output merged file to show `#ifdef NAME' diffs.
Similar, but format GTYPE input groups with GFMT.
Similar, but format all input lines with LFMT.
Similar, but format LTYPE input lines with LFMT.
GTYPE is LTYPE or `changed'.
GFMT may contain:
%<
lines from FILE1
%>
lines from FILE2
%=
lines common to FILE1 and FILE2
%[-][WIDTH][.[PREC]]{doxX}LETTER
printf-style spec for LETTER
LETTERs are as follows for new group, lower case for old group:
first line number
last line number
number of lines = L-F+1
F-1
L+1
LFMT may contain:
%L
contents of line
%l
contents of line, excluding any trailing newline
%[-][WIDTH][.[PREC]]{doxX}n
printf-style spec for input line number
Either GFMT or LFMT may contain:
%%
%
%c'C'
the single character C
%c'\OOO'
the character with octal code OOO
Pass the output through `pr' to paginate it.
Expand tabs to spaces in output.
Make tabs line up by prepending a tab.
Recursively compare any subdirectories found.
-N --new-file
Treat absent files as empty.
Treat absent first files as empty.
Report when two files are the same.
Exclude files that match PAT.
Exclude files that match any pattern in FILE.
Start with FILE when comparing directories.
Compare FILE1 to all operands. FILE1 can be a directory.
Compare all operands to FILE2. FILE2 can be a directory.
Keep NUM lines of the common prefix and suffix.
Try hard to find a smaller set of changes.
Assume large files and many scattered small changes.
Output version info.
Output this help.

FILES are `FILE1 FILE2' or `DIR1 DIR2' or `DIR FILE...' or `FILE... DIR'. If --from-file or --to-file is given, there are no restrictions on FILES. If a FILE is `-', read standard input.

AUTHOR

Written by Paul Eggert, Mike Haertel, David Hayes, Richard Stallman, and Len Tower.

REPORTING BUGS

Report bugs to <bug-gnu-utils@gnu.org>.

COPYRIGHT

Copyright © 2002 Free Software Foundation, Inc.

This program comes with NO WARRANTY, to the extent permitted by law. You may redistribute copies of this program under the terms of the GNU General Public License. For more information about these matters, see the file named COPYING.

SEE ALSO

The full documentation for diff is maintained as a Texinfo manual. If the info and diff programs are properly installed at your site, the command

info diff

should give you access to the complete manual.

November 2010 diffutils 2.8.1